package string.leetcode_344;

public class TwoPointer {
    public void reverseString(char[] s) {
        int len = s.length;
        if (len == 0) {
            return;
        }
        int left = 0;
        int right = len - 1;
        while (left < right) {
            swap(s, left, right);
            left++;
            right--;
        }
    }

    public void swap(char[] s, int i, int j) {
        char temp = s[i];
        s[i] = s[j];
        s[j] = temp;
    }
}
